@using Elsa.Dashboard.ActionFilters
@using Elsa.Dashboard.Extensions
@using Elsa.Dashboard.Models
@{
    var notifications = TempData.Get<IList<Notification>>(NotifierFilter.TempDataKey);
}

@if (notifications != null)
{
    <div class="container-fluid align-items-center">
        <div class="row">
            <div class="col">
                @foreach (var notification in notifications)
                {
                    string iconClass;
                    string alertClass;
                    switch (notification.Type)
                    {
                        case NotificationType.Error:
                            iconClass = "fas fa-exclamation-circle mr-1";
                            alertClass = "alert-error";
                            break;
                        case NotificationType.Information:
                            iconClass = "ni ni-bulb-61";
                            alertClass = "alert-info";
                            break;
                        case NotificationType.Warning:
                            iconClass = "fas fa-exclamation-triangle mr-1";
                            alertClass = "alert-warning";
                            break;
                        default:
                            iconClass = "fas fa-check-circle mr-1";
                            alertClass = "alert-success";
                            break;
                    }
                    <div class="alert @alertClass alert-dismissible fade show col-xl-8 offset-xl-2 col-lg-12 offset-lg-0 col-md-12 offset-md-0 col-sm-12 offset-sm-0" role="alert">
                        <span class="alert-inner--icon">
                            <i class="@iconClass"></i>
                        </span>
                        <span class="alert-inner--text">@notification.Message</span>
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                }
            </div>
        </div>
    </div>
}